package com.zfzs.post.modules.transaction.service;

import com.zfzs.post.model.vo.TransactionSumVO;
import com.zfzs.post.modules.transaction.domain.TransactionInfo;
import com.zfzs.post.modules.transaction.service.dto.*;
import org.springframework.data.domain.Pageable;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * 终端交易
 *
 * @author ck
 * @date 2019-10-08
 */
public interface TransactionInfoService {

    /**
     * queryAll 分页
     *
     * @param criteria
     * @param pageable
     * @return
     */
    Object queryAll(TransactionInfoQueryCriteria criteria, Pageable pageable);

    /**
     * queryAll 不分页
     *
     * @param criteria
     * @return
     */
    Object queryAll(TransactionInfoQueryCriteria criteria);

    /**
     * findById
     *
     * @param transactionId
     * @return
     */
    TransactionInfo findById(Long transactionId);

    /**
     * create
     *
     * @param resources
     * @return
     */
    TransactionInfo create(TransactionInfo resources);

    /**
     * update
     *
     * @param resources
     */
    void update(TransactionInfo resources);

    /**
     * delete
     *
     * @param transactionId
     */
    void delete(Long transactionId);

    /**
     * 根据时间、代理商查询总交易
     * @param id
     * @param startDate
     * @param endDate
     * @return
     */
    BigDecimal queryTransactionSumByDate(Long id, String startDate, String endDate);
    /**
     * 根据时间、代理商查询总交易条数
     * @param id
     * @param startDate
     * @param endDate
     * @return
     */
    int queryTransactionCountByDate(Long id, String startDate, String endDate);

    /**
     * 根据时间、地阿里上查询
     * @param channelId
     * @param ids
     * @param startDate
     * @param endDate
     * @return
     */
    BigDecimal querySumByAgentIds(Long channelId, List<Long> ids, String startDate, String endDate);

    /**
     * 流水统计明细
     * @param channelId
     * @param ids
     * @param startDate
     * @param endDate
     * @return
     */
    TransactionSumVO queryTransactionSum(Long channelId, List<Long> ids, String startDate, String endDate);

    /**
     * 台均交易
     * @param params
     * @return
     */
    List<TerAvgTransactionDTO> findTerAvgTransaction(Map<String, Object> params);

    /**
     * 总均交易
     * @param params
     * @return
     */
    List<TerSumTransactionDTO> findTerSumTransaction(Map<String, Object> params);

    /**
     * 未分润列表
     * @param tranDate
     * @param channelId
     * @return
     */
    List<TransactionInfo> queryNotBenefitTransaction(String tranDate, Long channelId);

    /**
     * 根据等级分组
     * @param params
     * @return
     */
    List<SumTranByLevelDTO> findSumTranGroupByLevel(Map<String,Object> params);

    /**
     * 根据类型分组
     * @param params
     * @return
     */
    List<SumTranByTypeDTO> findSumTranGroupByType(Map<String, Object> params);
}